package com.itheima.service.db.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.db.Admin;
import com.itheima.mapper.AdminMapper;
import com.itheima.service.db.AdminService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Author 请不要叫我高司令
 * @Date 2022/3/24 17:22
 * @Version 1.0
 */

@DubboService
public class AdminServiceImpl implements AdminService {

    @Autowired
    private AdminMapper adminMapper;

    @Override
    public Admin login(String username, String password) {

        //构建条件
        LambdaQueryWrapper<Admin> queryWrapper = new LambdaQueryWrapper<>();

        queryWrapper.eq(Admin::getUsername, username)
                .eq(Admin::getPassword, password);

        //mapper查询
        return adminMapper.selectOne(queryWrapper);

    }
}
